#pragma once

#include <unistd.h>
#include <fcntl.h>
#include <iostream>

void SetNonBlock(int fd)
{
    int n = ::fcntl(fd, F_GETFL);
    if(n<0)
    {
        std::cout<<"fcntl error"<<std::endl;
        return;
    }
    ::fcntl(fd, F_SETFL, n | O_NONBLOCK);
}